// Package day_01_base_sort bubble_sort
// @Title day_01_base_sort
// @Description
// @Author  == 琳琳也叫王木木 ==  2021/8/30 17:02
// @Create  2021/8/30 17:02
package day_01_base_sort

// BubbleSort 冒泡排序实现
func BubbleSort(nums []int) []int {
	arrLen := len(nums)
	if nums == nil || arrLen < 2 {
		return nums
	}
	for i := 0; i < arrLen; i++ {
		for j := i + 1; j < arrLen; j++ {
			if nums[i] > nums[j] {
				nums[i], nums[j] = nums[j], nums[i]
			}
		}
	}
	return nums
}
